<template>
    <IDrawer v-model="defaultValue" :loading="loading" :width="860" title="添加快递">
        <Form :model="data" :label-width="100" :rules="ruleValidate" ref="formCreate">
            <FormItem label="快递代码" prop="code">
                <Input v-model="data.code"></Input>
            </FormItem>
            <FormItem label="快递名称" prop="name">
                <Input v-model="data.name"></Input>
            </FormItem>
            <FormItem label="海关代码" prop="customs_code">
                <Input v-model="data.customs_code"></Input>
            </FormItem>
            <FormItem label="海关名称" prop="customs_name" >
                <Input v-model="data.customs_name"></Input>
            </FormItem>
            <FormItem label="保费" prop="insured" >
                <Input v-model="data.insured" number></Input>
            </FormItem>
            <FormItem label="联系电话" prop="phone">
                <Input v-model="data.phone"></Input>
            </FormItem>
            <FormItem label="联系人" prop="contacts">
                <Input v-model="data.contacts"></Input>
            </FormItem>
            <FormItem label="备注">
                <Input v-model="data.remark" :rows="4" type="textarea"></Input>
            </FormItem>

        </Form>
        <div slot="footer">
            <Button type="primary" icon="ios-add" @click="submit('formCreate')">提交</Button>
            <Button type="warning" icon="md-log-out" @click="defaultValue = false;">返回</Button>
        </div>
    </IDrawer>
</template>

<script>
    import IForm from "../../../components/content/form";
    import contentDrawer from "../../../mixins/contentDrawer";
    import IDrawer from "../../../components/content/drawer";
    import IData from "./data";

    export default {
        name: "create",
        mixins: [contentDrawer, IData],
        components: {IForm, IDrawer},
        data() {
            return {}
        },
        methods: {
            submit(data) {
                this.validate(data).then(() => {
                    this.loading = true;
                    this.$http.post('system/express', this.data).then(() => {
                        this.loading = false;
                        this.defaultValue = false;
                    });
                });
            }
        }
    }
</script>

<style scoped>

</style>
